<?php
/* @var $this HoraireController */
/* @var $model Horaire */
/* @var $form CActiveForm */
?>
<?php echo CHtml::activeHiddenField($model, '[' . $index . ']periodeid', array('size' => 20, 'maxlength' => 255)); ?>

<div style="margin-bottom: 20px; display: <?php echo!empty($display) ? $display : 'none'; ?>; width:100%; clear:left;" class="crow">
    <div class="row heure" style="float: left;">
	  <?php echo CHtml::activeTimeField($model, '[' . $index . ']heure', array('maxlength' => 5)); ?>
    </div>

    <div class="row" style="float: left;">
	  <?php
	  $this->widget('ModeButtons', array(
		'attribute' => '[' . $index . ']modeid',
		'model' => $model,
		'manuel' => true,
	  ));
	  ?>
	  <?php echo CHtml::error($model, '[' . $index . ']modeid'); ?>
    </div>
    <div class="row" style="width:100px;float: left;">
        <br />
	  <?php echo CHtml::link('Delete', '#', array('title' => 'Supprimer', 'class' => 'delete', 'onclick' => 'deleteChild(this, ' . $index . '); return false;'));
	  ?>
    </div>
</div>

<?php
Yii::app()->clientScript->registerScript('deleteChild', "
function deleteChild(elm, index)
{
    element=$(elm).parent().parent();
    /* animate div */
    $(element).animate(
    {
        opacity: 0.25, 
        left: '+=50', 
        height: 'toggle'
    }, 500,
    function() {
        /* remove div */
        $(element).remove();
    });
}", CClientScript::POS_END);